package com.tanhua.server.controller;

import com.tanhua.server.service.TodayBestService;
import com.tanhua.common.vo.PageResult;
import com.tanhua.common.vo.RecommendUserQueryParam;
import com.tanhua.common.vo.TodayBest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//今日佳人功能接口
@RestController
@RequestMapping("tanhua")
@Slf4j
public class TodayBestController {
    @Autowired
    private TodayBestService todayBestService;

    @GetMapping("/todayBest")
    public TodayBest selectTodayBest() {
        TodayBest todayBest = null;
        try {
            todayBest = todayBestService.selectTodayBest();
        } catch (Exception e) {
            log.error("今日佳人", e);

        }
        if (todayBest == null) return null;

        return todayBest;
    }

    @GetMapping("recommendation")
    public PageResult selectRecommendation(RecommendUserQueryParam param) {
        PageResult pageResult = todayBestService.selectRecommendation(param);

        return pageResult;
    }

}
